package com.example.education.Mapper;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.education.Bean.CollegeSubjects;
import com.example.education.Bean.StudentInfo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.ArrayList;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 姚
 * @since 2023-03-27
 */

@Mapper
public interface CollegeSubjectsMapper extends BaseMapper<CollegeSubjects> {

    //增
    @Insert("INSERT INTO college_subjects (uid,university_Name,subject_Name,exam_Score_Line,exam_Subjects_Text,research_Directions,admission_Ratio,adjustment_Info) values" +
            " (#{uid},#{universityName},#{subjectName},#{examScoreLine},#{examSubjectsText},#{researchDirections},#{admissionRatio},#{adjustmentInfo})")
    int insert(CollegeSubjects collegeSubjects);

    //删
    @Delete("delete from college_subjects where uid=#{uid}")
    int delete(Integer uid);

    //查
    @Select("select * from college_subjects where university_name=#{collegename}")
    ArrayList<CollegeSubjects> select(String collegename);

    //改
    int update(CollegeSubjects collegeSubjects, UpdateWrapper<StudentInfo> updateWrapper);

    //根据分数查找学校
    @Select("select * from college_subjects where hard_Score=#{grade}")
    ArrayList<CollegeSubjects> selectByGrade(Integer grade);

    //查所有
    @Select("select * from college_subjects")
    CollegeSubjects[] findAll();


}
